package com.fwmagic.spark.core.action

import org.apache.spark.{SparkConf, SparkContext}

/**
  * 遍历数据集中的每一条数据
  */
object ForeachDemo {
    def main(args: Array[String]): Unit = {
        val conf = new SparkConf()
                .setAppName(this.getClass.getSimpleName)
                .setMaster("local[1]")

        val sc = new SparkContext(conf)

        val rdd1 = sc.makeRDD(1 to 10)

        rdd1.foreach(x => println(x))

        //rdd1.foreach(println)
        sc.stop()
    }
}
